function status = SK6_Write( address, data )
% SHAKE SK6 Matlab Driver v1.00, (c) 2010 SAMH Engineering Services
%
% function status = SK6_Write( address, data )
% This function writes <data> to <address> register on the SK6.
% It does not look for a ACK or NAK packet returned from the SK6.
% <address> is the address to write to as a 4 digit hex string.
% <data> is the data value to write as a 2 digit hex string.
% 
% The data is only transmitted if the Clear to Send (CTS) line is active.
% If CTS was inactive, false is returned.
%
% Example: To set the acceleration data rate to 100Hz
% status = SK6_Write( '0008' , '64' );

global port

if strcmp( port.PinStatus.ClearToSend , 'on')
header = strcat( '$WRI,' , address , ',' , data );
fprintf( port , header );

pause(0.01); % wait 10mS to allow SK6 time to digest
status = true;
else
    status = false;
end

end 
